package com.zjq.designpatterns.behaviors.strategy.code;/*
 * 版权信息: 北京千⾥马网信科技有限公司</br>
 * Copyright ©2008-2018. All rights reserved. 京ICP备16007318号
 */

/**
 * @author jessie
 * @version 1.0
 * @date 2021/1/25
 */
public class Test {
    public static void main(String[] args) {
        //v1
        //选择不同的促销策略
        PromotionActitity promotionActitity618 = new PromotionActitity(new LijianPromotionStrategy());
        PromotionActitity promotionActitity1111 = new PromotionActitity(new FanxianPromotionStrategy());
        promotionActitity618.executePromotionStrategy();
        promotionActitity1111.executePromotionStrategy();
    }

    //v2
//    public static void main(String[] args) {
//        PromotionActitity promotionActitity = null;
//        String promotionKey = "LIJIAN";
//        if("LIJIAN".equalsIgnoreCase(promotionKey)){
//            promotionActitity = new PromotionActitity(new LijianPromotionStrategy());
//        }else if("FANXIAN".equalsIgnoreCase(promotionKey)){
//            promotionActitity = new PromotionActitity(new FanxianPromotionStrategy());
//        }else if("MANJIAN".equalsIgnoreCase(promotionKey)){
//            promotionActitity = new PromotionActitity(new ManjianPromotionStrategy());
//        }
//        promotionActitity.executePromotionStrategy();
//    }

    //v3
    //工厂+策略
//    public static void main(String[] args) {
//        //v2
//        //传参
//        String promotionKey = "LIJIAN";
//        PromotionActitity promotionActitity = new PromotionActitity(PromotionStrategyFactory.getPromotionStrategy(promotionKey));
//        promotionActitity.executePromotionStrategy();
//    }
}
